/**
 * 这个js用来获取url中的base-id，保存在全局变量globalBaseId中，并设置在cookie里每次请求发送给服务端
 * 
 * 
 */
//取url参数
function getParam(paramName) {
  paramValue = "";
  isFound = false;
  if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
      arrSource = decodeURI(this.location.search).substring(1, this.location.search.length).split("&");
      i = 0;
      while (i < arrSource.length && !isFound) {
          if (arrSource[i].indexOf("=") > 0) {
              if (arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase()) {
                  paramValue = arrSource[i].split("=")[1];
                  isFound = true;
              }
          }
          i++;
      }
  }
  return paramValue;
}

//取cookie
function getCookie(name) {
  var match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
  if (match) return match[2];
}


var globalBaseId = getParam('base_id');
console.log(globalBaseId);
if(globalBaseId) {
  document.cookie="base_id=" + getParam('base_id');
}